<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script type="text/javascript" src="../js/vue.js"></script>
  <title>事件处理</title>
</head>
<body>
  <div id="root">
    <h2>键盘事件</h2>
    <hr>
    <input type="text" @keyup="showInfo" placeholder="实时提示">
    <input type="text" @keyup.enter="showInfo" placeholder="回车确认">
    <input type="text" @keyup.ctrl.y="showInfo" placeholder="ctrl+y确认">
  </div>
  <script type="text/javascript">
    Vue.config.productionTip = false 
    const vm = new Vue({
      el: '#root',
      methods: {
        showInfo(event) {
          // console.log(event.key,event.keyCode);
          console.log(event.target.value);
        }
      }
    })
  </script>
</body>
</html>